# -*- coding: utf-8 -*-
# @File: backend => actions.py
# @CreateTime: 2025/8/25 21:39
# @Author: EvanZhang
# @Info: 玩家行动日志

from tortoise import fields, models

# id | hand_id | user_id | action_type | amount | timestamp
class Action(models.Model):
    id = fields.IntField(pk=True)
    hand = fields.ForeignKeyField('models.Hand', related_name="actions", description="所属牌局")
    user = fields.ForeignKeyField("models.User", related_name="actions", description="所属用户")
    action_type = fields.CharField(max_length=20, description="行动类型，如fold, call, raise")
    amount = fields.IntField(description="行动涉及的筹码数")
    timestamp = fields.DatetimeField(auto_now_add=True, description="行动时间")

    class Meta:
        table = "actions"
        description = "玩家行动日志表"
        index_together = (("hand", "user"),)
